{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-12-18T01:58:21.341135Z",
     "start_time": "2024-12-18T01:58:21.326932Z"
    }
   },
   "source": [
    "# 导入必要的库\n",
    "import pandas as pd  # 用于数据操作和分析\n",
    "import numpy as np   # 用于数值计算\n",
    "import matplotlib.pyplot as plt  # 用于数据可视化\n",
    "import seaborn as sns  # 用于统计数据可视化\n",
    "\n",
    "# 忽略警告信息，避免显示不必要的警告\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "\n",
    "# 从CSV文件加载数据，假设文件名为 'data.csv'\n",
    "df = pd.read_csv('data.csv')\n",
    "\n",
    "# 定义一个列名列表，该列表包含需要删除的列名称\n",
    "list_name = ['id', 'Unnamed: 32']\n",
    "\n",
    "# 使用 drop 函数删除这两列，axis=1 表示删除列而非行\n",
    "df = df.drop(list_name, axis=1)\n",
    "\n",
    "# 替换 'diagnosis' 列中的值：\n",
    "# 'M'（恶性肿瘤）替换为 1，'B'（良性肿瘤）替换为 0\n",
    "# 这样可以将类别标签转换为数值型，方便后续机器学习任务\n",
    "df['diagnosis'] = df['diagnosis'].replace({'M': 1, 'B': 0})\n",
    "\n",
    "# 将特征数据（即除了 'diagnosis' 列以外的所有列）保存在 X 变量中\n",
    "X = df.drop(['diagnosis'], axis=1)\n",
    "\n",
    "# 将标签数据（即 'diagnosis' 列）保存在 Y 变量中\n",
    "Y = df['diagnosis']"
   ],
   "outputs": [],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T01:59:20.115660Z",
     "start_time": "2024-12-18T01:59:20.106232Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 从 scikit-learn 中导入所需的模块\n",
    "from sklearn.model_selection import train_test_split  # 用于数据集划分\n",
    "from sklearn.ensemble import RandomForestClassifier  # 导入随机森林分类器\n",
    "from sklearn.metrics import f1_score, confusion_matrix  # 导入 F1 分数和混淆矩阵\n",
    "from sklearn.metrics import accuracy_score, precision_score, recall_score, auc, roc_curve  # 导入其他评价指标\n",
    "from sklearn.tree import DecisionTreeClassifier  # 导入决策树分类器\n",
    "\n",
    "# 将数据集拆分为训练集和测试集\n",
    "x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.3, random_state=1234)\n",
    "# test_size=0.3 表示将 30% 的数据用于测试集，70% 用于训练集\n",
    "# random_state=1234 用于控制随机划分的结果，保证结果可复现\n",
    "\n",
    "# 打印训练集和测试集的形状\n",
    "print(x_train.shape)  # 打印训练特征数据的形状\n",
    "print(x_test.shape)   # 打印测试特征数据的形状\n",
    "print(y_train.shape)  # 打印训练标签数据的形状\n",
    "print(y_test.shape)   # 打印测试标签数据的形状"
   ],
   "id": "67c37437aff0bbab",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(398, 30)\n",
      "(171, 30)\n",
      "(398,)\n",
      "(171,)\n"
     ]
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:00:39.432262Z",
     "start_time": "2024-12-18T02:00:39.187797Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 导入逻辑回归模型\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "# 初始化逻辑回归模型\n",
    "model_1 = LogisticRegression()\n",
    "\n",
    "# 使用训练集数据训练模型\n",
    "model_1.fit(x_train, y_train)\n",
    "\n",
    "# 使用训练好的模型对测试集进行预测\n",
    "y_pred = model_1.predict(x_test)\n",
    "\n",
    "# 计算准确率、精确率和召回率\n",
    "accuracy_score_1 = accuracy_score(y_test, y_pred)  # 计算准确率\n",
    "precision_score_1 = precision_score(y_test, y_pred)  # 计算精确率\n",
    "recall_score_1 = recall_score(y_test, y_pred)  # 计算召回率\n",
    "\n",
    "# 输出评估指标：准确率、精确率和召回率\n",
    "print('Before Data Scaler, Accuracy is：\\t%0.3f' % accuracy_score_1)\n",
    "print('Before Data Scaler, Precision is：\\t%0.3f' % precision_score_1)\n",
    "print('Before Data Scaler, Recall is：\\t%0.3f' % recall_score_1)\n",
    "\n",
    "# 生成混淆矩阵并使用热图可视化\n",
    "cm_1 = confusion_matrix(y_test, y_pred)\n",
    "sns.heatmap(cm_1, annot=True, fmt=\"d\")"
   ],
   "id": "83c9284c89f28632",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Before Data Scaler, Accuracy is：\t0.918\n",
      "Before Data Scaler, Precision is：\t0.948\n",
      "Before Data Scaler, Recall is：\t0.833\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGbCAYAAAC2xPjaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAc3ElEQVR4nO3dbXxV5Znv8X8kbLIJLUkAnyrI0SRSHawxYAhi1dTIp0Kc1IjQyaBkjsIRHyrnACrEsVVisB0OU+pTqsZ0MJYxVPQEFYNHO6NIIKAm1jZOolWoKBJi0jy6Q/Y+L7p2TneDncRZOytw/b6fz3rBvZdrXftVLq/ruu8dEwqFQgIAACad4HUAAADAOyQCAAAYRiIAAIBhJAIAABhGIgAAgGEkAgAAGEYiAACAYSQCAAAYRiIAAIBhsV4H0NP0gdchAMOO/9SLvA4BGJaOBD6O6vPd/Js0cvwZrj0rmjxPBAAAGDaCvV5HMORoDQAAYBiJAAAAYaGge9dX0NzcrOzsbO3atatvrba2VvPmzVNaWpqysrJUUVER8d9s2bJF2dnZOu+883TVVVfprbfeGtQ7SQQAAAgLBt27Bmnv3r2aP3++9u3b17fW2tqqxYsXKzc3VzU1N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QAAAIaRCAAAYBiJAAAAhpEIAABgGIkAAACGkQhAhw8f1tKlSzVt2jRlZGSoqKhIR44c8TosYFhobm5Wdna2du3a5XUoQFSQCEC33XabRo8erddee02bN2/Wzp07VVZW5nVYgOf27t2r+fPna9++fV6HAkQNiYBxH330kXbv3q0VK1bI7/dr4sSJWrp0qcrLy70ODfDUli1btHz5ci1btszrUICoIhEwrqGhQQkJCTrppJP61s4880wdOHBAf/zjHz2MDPDWrFmztH37dl1xxRVehwJEFYmAcR0dHfL7/RFr4X93dnZ6ERIwLEyYMEGxsfxSO45/JALGjR49Wl1dXRFr4X/Hx8d7ERIAYAiRCBiXkpKilpYWNTU19a29//77Ovnkk/W1r33Nw8gAAEOBRMC4yZMnKz09Xffdd5/a29u1f/9+PfTQQ7r66qu9Dg0AMARIBKANGzboyJEj+s53vqNrrrlGF110kZYuXep1WACAIRATCoVCXgcBAAC8QUUAAADDSAQAADCMRAAAAMNIBAAAMIxEAAAAw0gEAAAwjEQAAADDSAQAADCMRAAAAMNIBAAAMIxEAAAAw0gEAAAw7P8BAdK6lwzVmLoAAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 8
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T01:56:11.040367Z",
     "start_time": "2024-12-18T01:56:10.837561Z"
    }
   },
   "cell_type": "code",
   "source": [
    "model_1 = DecisionTreeClassifier()\n",
    "model_1.fit(x_train,y_train)\n",
    "y_pred = model_1.predict(x_test)\n",
    "\n",
    "accuracy_score_1 = accuracy_score(y_test,y_pred)\n",
    "precision_score_1 = precision_score(y_test,y_pred)\n",
    "recall_score_1 = recall_score(y_test,y_pred)\n",
    "\n",
    "print('DecisionTreeClassifier Model Accuracy is:\\t%0.3f'%accuracy_score_1)\n",
    "print('DecisionTreeClassifier Model Precision is:\\t%0.3f'%precision_score_1)\n",
    "print('DecisionTreeClassifier Model Recall is:\\t%0.3f'%recall_score_1)\n",
    "\n",
    "cm_1 = confusion_matrix(y_test,y_pred)\n",
    "sns.heatmap(cm_1,annot=True,fmt=\"d\")"
   ],
   "id": "10620408f8a5e837",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DecisionTreeClassifier Model Accuracy is:\t0.924\n",
      "DecisionTreeClassifier Model Precision is:\t0.921\n",
      "DecisionTreeClassifier Model Recall is:\t0.879\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGfCAYAAAAtVbrMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAdXklEQVR4nO3dfXRV9Z3v8U8gHHMIQhJFLS1IMYl4FTUNT1EsGokIEkyFCDa1JV1KrsEHqDyoBOuMhoBzLd6UqrkqN7eYpTUodeIDBGaoo0AgoCbKNZqoA1xhhBCJ5OFwTnL2/aP7ZHqEcYKzT3bg9365zh/8znbv71mrq3z8fn977yjLsiwBAAAj9XG7AAAA4B6CAAAABiMIAABgMIIAAAAGIwgAAGAwggAAAAYjCAAAYDCCAAAABiMIAABgMIIAAAC9RFNTkzIyMrRjx46utZqaGmVnZyslJUXp6ekqLy8P+3fWr1+vjIwMXXnllbrlllv0/vvvn9I1CQIAAPQCu3fv1qxZs7Rv376utebmZs2dO1dZWVmqrq5WYWGhioqKVFtbK0nasWOHHn30Ua1YsULV1dWaPn267rrrLrW3t3f7ugQBAABctn79ei1cuFALFiwIW6+srFRcXJxycnIUHR2ttLQ0ZWZmqqysTJJUXl6um266SampqerXr5/mzJmj+Ph4vfnmm92+NkEAAIAI8Pv9amlpCfv4/f6THjthwgRt2rRJU6dODV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hMHA0QBAAAsJkYBNgjAACAwegIAABgM68fIEVZJvZBAACAJEYDAAAYjSAAAIDBCAIAABiMIAAAgMEIAgAAGIwgAACAwQgCAAAYjCAAAIDBCAIAABiMIAAAgMEIAtCRI0eUn5+v0aNHa9y4cSosLFRHR4fbZQG9QlNTkzIyMrRjxw63SwEigiAAzZ8/X/3799c777yjdevWafv27SotLXW7LMB1u3fv1qxZs7Rv3z63SwEihiBguL1792rnzp1atGiRvF6vhg4dqvz8fJWVlbldGuCq9evXa+HChVqwYIHbpQARRRAwXH19veLi4nT++ed3rV100UU6cOCAvvnmGxcrA9w1YcIEbdq0SVOnTnW7FCCiCAKGa21tldfrDVsL/bmtrc2NkoBeYfDgwYqOjna7DCDiCAKG69+/v9rb28PWQn+OjY11oyQAQA8iCBguKSlJR48eVWNjY9faZ599pgsuuEBnn322i5UBAHoCQcBww4cPV2pqqpYvX66Wlhbt379fTz31lGbOnOl2aQCAHkAQgIqLi9XR0aHrr79et956q6655hrl5+e7XRYAoAdEWZZluV0EAABwBx0BAAAMRhAAAMBgBAEAAAxGEAAAwGAEAQAADEYQAADAYAQBAAAMRhAAAMBgBAEAAAxGEAAAwGAEAQAADPb/Aaese7bX939UAAAAAElFTkSuQmCC"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T01:57:08.951016Z",
     "start_time": "2024-12-18T01:57:08.689406Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.model_selection import GridSearchCV\n",
    "from sklearn.svm import SVC\n",
    "model_1 = SVC()\n",
    "model_1.fit(x_train,y_train)\n",
    "y_pred = model_1.predict(x_test)\n",
    "\n",
    "accuracy_score_1 = accuracy_score(y_test,y_pred)\n",
    "precision_score_1 = precision_score(y_test,y_pred)\n",
    "recall_score_1 = recall_score(y_test,y_pred)\n",
    "\n",
    "print('Before Feature selection, Accuracy is:\\t%0.3f'%accuracy_score_1)\n",
    "print('Before Feature selection, Precision is:\\t%0.3f'%precision_score_1)\n",
    "print('Before Feature selection, Recall is:\\t%0.3f'%recall_score_1)\n",
    "\n",
    "cm_1 = confusion_matrix(y_test,y_pred)\n",
    "sns.heatmap(cm_1,annot=True,fmt=\"d\")"
   ],
   "id": "e4976ac1c749e593",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Before Feature selection, Accuracy is:\t0.895\n",
      "Before Feature selection, Precision is:\t1.000\n",
      "Before Feature selection, Recall is:\t0.727\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGbCAYAAAC2xPjaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAeCElEQVR4nO3df3hU9Zn38U9IGDIEJUlBKQvCShKlFGsaEIKx1UjgUomb5adraiV9Kln5obAFVIjaqiO4Ty2aUjWrxlyLUdpQ0CfWYqIPtgUJJGgTRaKJPwgFCoRAJAlxJpnZPzyT3RG6BnsmJ/B9v7zOH/nO4Zx7vC6u3Nz3/T0nIhAIBAQAAIzUx+kAAACAc0gEAAAwGIkAAAAGIxEAAMBgJAIAABiMRAAAAIORCAAAYDASAQAADEYiAACAwaKcDsDX+LHTIQC9jnvoVU6HAPRKHd79Yb2+nb+T+g662LZrhZPjiQAAAL2Gv9PpCHocrQEAAAxGRQAAgKCA3+kIehyJAAAAQX4SAQAAjBUwsCLAjAAAAAajIgAAQBCtAQAADEZrAAAAmISKAAAAQQY+UIhEAACAIFoDAADAJCQCAAAE+f32HV9DU1OTMjIytGPHjq616upqzZo1S8nJyUpPT1dJSUnIn9m0aZM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oCAABYaA0AAGAwtg8CAGAwEysCzAgAAGAwKgIAAFhM3DVAIgAAgIXWAAAAMAoVAQAALOwaAADAYLx0CAAAGIWKAAAAFloDAAAYjF0DAADAKFQEAACwMCwIAIDBAoGAbceZOHr0qObPn69x48ZpwoQJ8ng86ujoCNO3DEUiAACAxalEYPHixerfv7/+9Kc/acOGDdq+fbuKiorC8yW/hEQAAAAH7d27Vzt37tSyZcvkdrs1fPhwzZ8/X8XFxT1yf2YEAACw2Dkh4PV65fV6Q9ZcLpdcLlfIWl1dnWJjY3XhhRd2rY0aNUoHDhzQZ599pvPPP9/GqE7leCKw5S/lTocAAIAkqcO737Zr/fKXv9TatWtD1hYuXKhFixaFrLW2tsrtdoesBX9ua2s79xMBAADORbm5ucrJyQlZ+3I1QJL69++vkydPhqwFf46JiQlfgBYSAQAAwuB0bYDTSUxM1PHjx9XY2KhBgwZJkj766CMNGTJE5513XrjDZFgQAAAnjRw5UikpKXr44YfV0tKiffv26YknntDMmTN75P4RAROfpwgAQC/S2NioBx54QDt27FCfPn2UlZWlpUuXKjIyMuz3JhEAAMBgtAYAADAYiQAAAAYjEQAAwGAkAgAAGIxEAI6+9Qro7ZqampSRkaEdO3Y4HQoQFiQCcPStV0BvtmvXLs2ZM0cNDQ1OhwKEDYmA4Zx+6xXQW23atElLly7VkiVLnA4FCCsSAcN91VuvAFOlpaWpvLxc119/vdOhAGFFImC4r3rrFWCqwYMHKyqK17Hg3EciYDin33oFAHAWiYDh/udbr4J68q1XAABnkQgYzum3XgEAnEUiAOXn56ujo0PXXnutZs+erauuukrz5893OiwAQA/g7YMAABiMigAAAAYjEQAAwGAkAgAAGIxEAAAAg5EIAABgMBIBAAAMRiIAAIDBSAQAADAYiQAAAAYjEQAAwGAkAgAAGIxEAAAAg/0XP1kbY/2QcBAAAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:04:58.117454Z",
     "start_time": "2024-12-18T02:04:57.883933Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#feature scaling\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "sc = StandardScaler()\n",
    "x_train_scaled = sc.fit_transform(x_train)\n",
    "x_test_scaled = sc.fit_transform(x_test)\n",
    "\n",
    "model_2 = LogisticRegression()\n",
    "model_2.fit(x_train_scaled,y_train)\n",
    "y_pred = model_2.predict(x_test_scaled)\n",
    "\n",
    "accuracy_score_2 = accuracy_score(y_test,y_pred)\n",
    "precision_score_2 = precision_score(y_test,y_pred)\n",
    "recall_score_2 = recall_score(y_test,y_pred)\n",
    "\n",
    "print('After Data Scaler, Accuracy is：\\t%0.3f'%accuracy_score_2)\n",
    "print('After Data Scaler, Precision is：\\t%0.3f'%precision_score_2)\n",
    "print('After Data Scaler, Recall is：\\t%0.3f'%recall_score_2)\n",
    "\n",
    "cm_2 = confusion_matrix(y_test,y_pred)\n",
    "sns.heatmap(cm_2,annot=True,fmt=\"d\")"
   ],
   "id": "d05d87e1e85429a4",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "After Data Scaler, Accuracy is：\t0.959\n",
      "After Data Scaler, Precision is：\t0.968\n",
      "After Data Scaler, Recall is：\t0.924\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGbCAYAAAC2xPjaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAc6ElEQVR4nO3df3RV9Znv8U9MOOSQqEmQSlXAahK1FjQGDVGoYyTSCmFSwg+nqUpmKhlx2kIL+IP4o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gRYI0AAACG0REAAMDBaAAAAMMYDQAAAFPoCAAA4GA0AACAYYwGAACAKXQEAABwMBoAAMAwRgMAAMAUOgIAADjC4ZDXJQw5ggAAAI6QwdEAQQAAAEfY4GJB1ggAAGAYHQEAAByMBgAAMIzRAAAAMIWOAAAADp4sCACAYTxZEAAAmEJHAAAAh8XFggQBAAAcFm8fZDQAAIBhdAQAAHAwGgAAwDBuHwQAwDCLHQHWCAAAYBgdAQAAHBbvGiAIAADgYDQAAABMoSMAAICDuwYAADCMlw4BAABT6AgAAOBgNAAAgGHcNQAAAEyhIwAAgMPiYkGCAAAADoujAYIAAAAOi0GANQIAABhGRwAAAIe9foAUF7bYBwEAAJIYDQAAYBpBAAAAwwgCAAAYRhAAAMAwggAAAIYRBAAAMIwgAACAYQQBAAAMIwgAAGAYQQA6dOiQFi9erMmTJysnJ0fl5eU6evSo12UBw0J7e7vy8/O1fft2r0sBYoIgAC1ZskSjRo3Sa6+9po0bN2rbtm2qrKz0uizAc7t27dKCBQu0d+9er0sBYoYgYNy7776rHTt2aPny5fL7/Ro3bpwWL16sqqoqr0sDPLVp0yYtW7ZMS5cu9boUIKYIAsa1tLQoJSVFZ5999sC+Cy+8UPv379dHH33kYWWAt6ZOnaotW7boxhtv9LoUIKYIAsZ1d3fL7/dH7Yv83NPT40VJwLAwZswYJSTwpnZ89hEEjBs1apR6e3uj9kV+TkpK8qIkAMAQIggYl5GRoY6ODrW1tQ3s27Nnj8aOHavTTz/dw8oAAEOBIGDc+eefr+zsbK1atUpdXV3at2+ffvzjH2vu3LlelwYAGAIEAaiiokJHjx7V9ddfr/nz52vatGlavHix12UBAIZAXDgcDntdBAAA8AYdAQAADCMIAABgGEEAAADDCAIAABhGEAAAwDCCAAAAhhEEAAAwjCAAAIBhBAEAAAwjCAAAYBhBAAAAwwgCAAAY9v8BPBFgfikhM+8AAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 9
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:05:20.884830Z",
     "start_time": "2024-12-18T02:05:20.675431Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.feature_selection import SelectKBest\n",
    "from sklearn.feature_selection import chi2\n",
    "\n",
    "#找到得分最高的5个特征\n",
    "select_feature = SelectKBest(chi2, k=5).fit(x_train, y_train)\n",
    "print('Score list:', select_feature.scores_)\n",
    "print('Feature list:', x_train.columns)\n",
    "x_train_2 = select_feature.transform(x_train)\n",
    "x_test_2 = select_feature.transform(x_test)\n",
    "\n",
    "model_2 = DecisionTreeClassifier()\n",
    "model_2.fit(x_train_2, y_train)\n",
    "y_pred_2 = model_2.predict(x_test_2)\n",
    "\n",
    "accuracy_score_2 = accuracy_score(y_test, y_pred_2)\n",
    "precision_score_2 = precision_score(y_test, y_pred)\n",
    "recall_score_2 = recall_score(y_test, y_pred)\n",
    "\n",
    "print('By SelectKBest Feature selection,  Accuracy is：\\t%0.3f' % accuracy_score_2)\n",
    "print('By SelectKBest Feature selection, Precision is：\\t%0.3f' % precision_score_2)\n",
    "print('By SelectKBest Feature selection,  Recall is：\\t%0.3f' % recall_score_2)\n",
    "\n",
    "cm_2 = confusion_matrix(y_test, y_pred)\n",
    "sns.heatmap(cm_2, annot=True, fmt=\"d\")\n",
    "#### 2. 使用RFE进行特征选择"
   ],
   "id": "2f2b203ad8dfed28",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Score list: [1.87913721e+02 6.85324416e+01 1.43272288e+03 3.84449776e+04\n",
      " 1.26075194e-01 4.43626555e+00 1.53603687e+01 7.99471991e+00\n",
      " 1.88589962e-01 5.32435940e-04 2.62122123e+01 5.60223370e-02\n",
      " 1.95682083e+02 6.41060210e+03 2.38293207e-03 5.71400471e-01\n",
      " 9.21059030e-01 2.50624445e-01 2.50562814e-04 1.49880422e-02\n",
      " 3.48340710e+02 1.28616797e+02 2.64185700e+03 8.00300858e+04\n",
      " 3.32055794e-01 1.52328825e+01 3.02300724e+01 1.00253475e+01\n",
      " 9.01553876e-01 2.20394249e-01]\n",
      "Feature list: Index(['radius_mean', 'texture_mean', 'perimeter_mean', 'area_mean',\n",
      "       'smoothness_mean', 'compactness_mean', 'concavity_mean',\n",
      "       'concave points_mean', 'symmetry_mean', 'fractal_dimension_mean',\n",
      "       'radius_se', 'texture_se', 'perimeter_se', 'area_se', 'smoothness_se',\n",
      "       'compactness_se', 'concavity_se', 'concave points_se', 'symmetry_se',\n",
      "       'fractal_dimension_se', 'radius_worst', 'texture_worst',\n",
      "       'perimeter_worst', 'area_worst', 'smoothness_worst',\n",
      "       'compactness_worst', 'concavity_worst', 'concave points_worst',\n",
      "       'symmetry_worst', 'fractal_dimension_worst'],\n",
      "      dtype='object')\n",
      "By SelectKBest Feature selection,  Accuracy is：\t0.906\n",
      "By SelectKBest Feature selection, Precision is：\t0.968\n",
      "By SelectKBest Feature selection,  Recall is：\t0.924\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGbCAYAAAC2xPjaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAc6ElEQVR4nO3df3RV9Znv8U9MOOSQqEmQSlXAahK1FjQGDVGoYyTSCmFSwg+nqUpmKhlx2kIL+IP4o9UAOqtlJuPUnopM7sUsHUOlNo6G4FXvVUoggE1G29iEWqGiQgiJ5JcncM79o/tkegbqBLtPdvB5v1z7j+yz2fs5Ll358DzfvXdcOBwOCwAAmHSa1wUAAADvEAQAADCMIAAAgGEEAQAADCMIAABgGEEAAADDCAIAABhGEAAAwDCCAAAAhiV4XUB/2++8Lg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NAEAAAwGFxjQCjAQAADCMIAADgCIfDrm0no7m5WSUlJbrqqqt0zTXXaMWKFWpvb5ckNTY2at68ecrKylJeXp6qq6td/c4EAQAAHCEXt8Hq6+vTN7/5TWVlZen111/X888/r46ODt1zzz3q7OzUokWLVFhYqIaGBpWXl2v16tVqampy6RsTBAAAGBB28Z/B2r9/vy6++GLdcccd8vl8Sk1N1YIFC9TQ0KC6ujqlpKSouLhYCQkJys3NVUFBgaqqqlz7zgQBAABiIBgMqqurK2oLBoPHHXfBBRdo3bp1io+PH9i3efNmXXrppWppaVFmZmbU8enp6WpubnatToIAAACOkMKubYFAQNnZ2VFbIBD4xOuHw2GtXbtWr7zyilauXKnu7m75/f6oYxITE9XT0+Pad+b2QQAAHG6+dKi0tFQlJSVR+3w+3589vqurS3fffbfeeustPfnkk7rooovk9/t15MiRqOP6+vqUlJTkWp0EAQAAYsDn833iL/4/tXfvXt12220655xztHHjRqWlpUmSMjMztXXr1qhjW1tblZGR4VqdjAYAAHC4ORoYrM7OTt1666264oor9MQTTwyEAEnKz89XW1ubKisr1d/fr/r6etXU1KioqMi170xHAAAAhxePGH722We1f/9+vfjii6qtrY367I033tD69etVXl6uiooKpaWlqaysTFOmTHHt+nFhNwcin0LyqC94eXlgWHr7Mv6/AE7k3G0vx/T8f3XedNfO9eofXnLtXLFERwAAAEfI278be4IgAACAw14MYLEgAACm0REAAMBh8TXEBAEAABwEAQAADPP4RjpPsEYAAADD6AgAAOBgNAAAgGFePFnQa4wGAAAwjI4AAAAOi4sFCQIAADgsrhFgNAAAgGF0BAAAcDAaAADAMEYDAADAFDoCAAA4LD5HgCAAAIAjxBoBAADsstgRYI0AAACG0REAAMDBaAAAAMMYDQAAAFPoCAAA4GA0AACAYYwGAACAKXQEAABwMBoAAMAwRgMAAMAUOgIAADjC4ZDXJQw5ggAAAI6QwdEAQQAAAEfY4GJB1ggAAGAYHQEAAByMBgAAMIzRAAAAMIWOAAAADp4sCACAYTxZEAAAmEJHAAAAh8XFggQBAAAcFm8fZDQAAIBhdAQAAHAwGgAAwDBuHwQAwDCLHQHWCAAAYBgdAQAAHBbvGiAIAADgYDQAAABMoSMAAICDuwYAADCMlw4BAABT6AgAAOBgNAAAgGHcNQAAAEyhIwAAgMPiYkGCAAAADoujAYIAAAAOi0GANQIAABhGRwAAAIe9foAUF7bYBwEAAJIYDQAAYBpBAAAAwwgCAAAYRhAAAMAwggAAAIYRBAAAMIwgAACAYQQBAAAMIwgAAGAYQQA6dOiQFi9erMmTJysnJ0fl5eU6evSo12UBw0J7e7vy8/O1fft2r0sBYoIgAC1ZskSjRo3Sa6+9po0bN2rbtm2qrKz0uizAc7t27dKCBQu0d+9er0sBYoYgYNy7776rHTt2aPny5fL7/Ro3bpwWL16sqqoqr0sDPLVp0yYtW7ZMS5cu9boUIKYIAsa1tLQoJSVFZ5999sC+Cy+8UPv379dHH33kYWWAt6ZOnaotW7boxhtv9LoUIKYIAsZ1d3fL7/dH7Yv83NPT40VJwLAwZswYJSTwpnZ89hEEjBs1apR6e3uj9kV+TkpK8qIkAMAQIggYl5GRoY6ODrW1tQ3s27Nnj8aOHavTTz/dw8oAAEOBIGDc+eefr+zsbK1atUpdXV3at2+ffvzjH2vu3LlelwYAGAIEAaiiokJHjx7V9ddfr/nz52vatGlavHix12UBAIZAXDgcDntdBAAA8AYdAQAADCMIAABgGEEAAADDCAIAABhGEAAAwDCCAAAAhhEEAAAwjCAAAIBhBAEAAAwjCAAAYBhBAAAAwwgCAAAY9v8BPBFgfikhM+8AAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 10
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:05:35.937769Z",
     "start_time": "2024-12-18T02:05:35.640125Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.feature_selection import RFE\n",
    "model_3 = DecisionTreeClassifier()\n",
    "rfe = RFE(estimator=model_3,n_features_to_select=5,step=1)\n",
    "rfe.fit(x_train,y_train)\n",
    "print('Chosen best 5 feature by rfe:',x_train.columns[rfe.support_])\n",
    "y_pred_3 = rfe.predict(x_test)\n",
    "\n",
    "accuracy_score_3 = accuracy_score(y_test,y_pred_3)\n",
    "precision_score_3 = precision_score(y_test,y_pred_3)\n",
    "recall_score_3 = recall_score(y_test,y_pred_3)\n",
    "\n",
    "print('By RFE Feature selection, Accuracy is：\\t%0.3f'%accuracy_score_3)\n",
    "print('By RFE Feature selection, Precision is：\\t%0.3f'%precision_score_3)\n",
    "print('By RFE Feature selection, Recall is：\\t%0.3f'%recall_score_3)\n",
    "\n",
    "cm_4 = confusion_matrix(y_test,y_pred_3)\n",
    "sns.heatmap(cm_4,annot=True,fmt=\"d\")"
   ],
   "id": "be867cf155bcb5a6",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chosen best 5 feature by rfe: Index(['concave points_mean', 'texture_worst', 'perimeter_worst', 'area_worst',\n",
      "       'fractal_dimension_worst'],\n",
      "      dtype='object')\n",
      "By RFE Feature selection, Accuracy is：\t0.924\n",
      "By RFE Feature selection, Precision is：\t0.884\n",
      "By RFE Feature selection, Recall is：\t0.924\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfsAAAGbCAYAAADDfzmIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAaT0lEQVR4nO3df5iWdZ0v8M/AMDAgK4z5I8sfl85MmlERIFJ4VSjRuqEcFa3DWrJrcBaPZpvgD7DtSkcgc/Eif82WSBldFq7WQkdEy9NJ1EQ3oTxRoEflhKuMA6Mzw+yMPM/5o/thm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xpw5c/IuC4AyqSgWi8W8iwAAeo/OHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHH/D76OECzMOMzLAAAAAElFTkSuQmCC"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:05:50.760654Z",
     "start_time": "2024-12-18T02:05:49.918630Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.feature_selection import RFECV\n",
    "model_4= DecisionTreeClassifier()\n",
    "rfecv = RFECV(estimator=model_4,step=1,cv=5,scoring='accuracy')\n",
    "rfecv.fit(x_train,y_train)\n",
    "print('Optimal number of feature:',rfecv.n_features_)\n",
    "print('Best feature:',x_train.columns[rfecv.support_])\n",
    "y_pred_4 = rfe.predict(x_test)\n",
    "\n",
    "accuracy_score_4 = accuracy_score(y_test,y_pred_4)\n",
    "precision_score_4 = precision_score(y_test,y_pred_4)\n",
    "recall_score_4 = recall_score(y_test,y_pred_4)\n",
    "\n",
    "print('By RFECV Feature selection, Accuracy is：\\t%0.3f'%accuracy_score_3)\n",
    "print('By RFECV Feature selection, Precision is：\\t%0.3f'%precision_score_3)\n",
    "print('By RFECV Feature selection, Recall is：\\t%0.3f'%recall_score_3)\n",
    "\n",
    "cm_4 = confusion_matrix(y_test,y_pred_3)\n",
    "sns.heatmap(cm_4,annot=True,fmt=\"d\")"
   ],
   "id": "8a6d39fa85c7ff0e",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optimal number of feature: 4\n",
      "Best feature: Index(['concave points_mean', 'texture_worst', 'perimeter_worst',\n",
      "       'fractal_dimension_worst'],\n",
      "      dtype='object')\n",
      "By RFECV Feature selection, Accuracy is：\t0.924\n",
      "By RFECV Feature selection, Precision is：\t0.884\n",
      "By RFECV Feature selection, Recall is：\t0.924\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfsAAAGbCAYAAADDfzmIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAaT0lEQVR4nO3df5iWdZ0v8M/AMDAgK4z5I8sfl85MmlERIFJ4VSjRuqEcFa3DWrJrcBaPZpvgD7DtSkcgc/Eif82WSBldFq7WQkdEy9NJ1EQ3oTxRoEflhKuMA6Mzw+yMPM/5o/thm7Q9jDzDPfPl9eq6/5ibu/v5PPXH+/p8vt/7fiqKxWIxAIBkDci7AACgdwl7AEicsAeAxAl7AEicsAeAxAl7AEicsAeAxAl7AEicsAeAxFXmXUBX03N5lwB9ziHHnJ53CdAnvdbWu5lRzkwa9I7jynavfZV72ANAn1HYnXcFvcIYHwASp7MHgJJiIe8KeoWwB4CSgrAHgKQVE+3srdkDQOJ09gBQYowPAIkzxgcA+iOdPQCUJPpSHWEPACXG+ABAf6SzB4ASu/EBIG1eqgMA9Es6ewAoMcYHgMQlOsYX9gBQkuhz9tbsASBxOnsAKDHGB4DEJbpBzxgfABKnsweAEmN8AEicMT4A0B/p7AEgUyym+Zy9sAeAkkTX7I3xASBxOnsAKEl0g56wB4CSRMf4wh4ASvwQDgDQH+nsAaDEGB8AEpfoBj1jfABInM4eAEqM8QEgccb4AEB/pLMHgJJEO3thDwCZVH/1zhgfABKnsweAEmN8AEicR+8AIHGJdvbW7AEgcTp7ACgxxgeAxBnjAwD9kc4eAEqM8QEgccb4AEB/pLMHgJJEO3thDwAlia7ZG+MDQOJ09gBQYowPAIlLdIwv7AGgJNHO3po9ACROZw8AJcb4AJA4Y3wAoD/S2QNASaKdvbAHgJJiMe8KeoUx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obm6OyZMnxy9+8Yu8S4G3TdgTl112WQwdOjR+/vOfxz333BOPPfZYLF++PO+yIHdPPfVUnH/++fHiiy/mXQrsE2F/gHvhhRfiiSeeiLlz50Z1dXUcddRRMWfOnFixYkXepUGu7rvvvrj88svji1/8Yt6lwD4T9ge4zZs3x4gRI+Lwww/fc+7444+Pbdu2xWuvvZZjZZCviRMnxoMPPhhnnHFG3qXAPhP2B7i2traorq7udq70d3t7ex4lQZ9w6KGHRmWlXwEnDcL+ADd06NDYtWtXt3Olv4cNG5ZHSQCUmbA/wNXV1cXOnTujqalpz7lnn302jjjiiBg+fHiOlQFQLsL+AHfsscfGmDFj4vrrr4/W1tbYunVr3HrrrXHuuefmXRoAZSLsiaVLl8Ybb7wRp512Wpx33nlx6qmnxpw5c/IuC4AyqSgWi8W8iwAAeo/OHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHHCHgASJ+wBIHH/D76OECzMOMzLAAAAAElFTkSuQmCC"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 12
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-18T02:06:43.178251Z",
     "start_time": "2024-12-18T02:06:10.036939Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.model_selection import GridSearchCV\n",
    "from sklearn import svm\n",
    "\n",
    "model=svm.SVC()\n",
    "params={'C':[6,7,8,9,10,11,12],\n",
    "       'kernel':['linear','rbf']}\n",
    "model1=GridSearchCV(model,param_grid=params,n_jobs=-1)\n",
    "model1.fit(x_train,y_train)\n",
    "print(\"Best Hyper Parameters:\\n\",model1.best_params_)\n",
    "prediction = model1.predict(x_test)\n",
    "\n",
    "from sklearn import metrics\n",
    "print(\"Accuracy:\",metrics.accuracy_score(prediction,y_test))\n",
    "print(\"Confusion Metrix:\\n\",metrics.confusion_matrix(prediction,y_test))"
   ],
   "id": "ed7beeac3d501a81",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Best Hyper Parameters:\n",
      " {'C': 9, 'kernel': 'linear'}\n",
      "Accuracy: 0.935672514619883\n",
      "Confusion Metrix:\n",
      " [[102   8]\n",
      " [  3  58]]\n"
     ]
    }
   ],
   "execution_count": 13
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "4c4bd48123de94c6"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
